//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 12/03/2010
//-----------------------------------------------------------------------------
#ifndef LINE_H
#define LINE_H

#include "point.h"

namespace bend2d
{
	class Line 
	{
	public:
        Line();
        Line(const Point& from, const Point& to);
        Line(double xfrom, double yfrom, double xto, double yto);
        const Point& GetFrom() const;
        const Point& GetTo() const;
        void SetFrom(const Point& point);
        void SetTo(const Point& point);

        enum LineDirection {eUnknown, eTopRight = 1, eTopLeft, eBottomLeft, eBottomRight };
        LineDirection GetLineDirection();

        void CalculateVariables();
        double GetAlpha() const;
        double GetBeta() const;
        double GetGamma() const;
        double CalculateX(double y) const;
        double CalculateY(double x) const;

        double GetLowX() const;
        double GetHighX() const;
        double GetLowY() const;
        double GetHighY() const;

	private:
        Point m_From;
        Point m_To;
        LineDirection m_Direction;
        double m_Alpha;
        double m_Beta;
        double m_Gamma;
        bool m_Changed;
        Point m_Low;
        Point m_High;
	};
}

#endif
